home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / graphics / mktil16a.zip / HEADERS.ZIP / WINDOWS.H < prev   
C/C++ Source or Header  |  1994-09-19  |  3KB  |  96 lines

  1. #define NORMAL_WINDOW 1
  2. #define FILE_SELECT_WINDOW 2
  3.  
  4. struct WINDOW
  5. {
  6.  byte huge *
  7.  int window_x, window_y;
  8.  word window_width, window_height;
  9. } window;
  10.  
  11. /****************************************************************************/
  12. /****************************************************************************/
  13. /****************************************************************************/
  14.  
  15. void make_window(int x, int y, word width, word height,
  16.          byte window_color, byte border_color, byte option)
  17. {
  18.  word a;
  19.  word dest_tmp, dest_tmp2, tmp;
  20.  
  21.  if (window!=NULL) return;
  22.  
  23.  window=(byte huge *)halloc((long)width*height,1);
  24.  if (window==NULL)
  25.  {
  26.   printf("error allocating window memory\n");
  27.   return;
  28.  }
  29.  
  30.  get_image(x,y,window,width,height);
  31.  window_x=x; window_y=y;
  32.  window_width=width; window_height=height;
  33.  
  34.  if (option=NORMAL_WINDOW)
  35.  {
  36.   tmp=(y<<8)+(y<<6)+x;
  37.   memset(&screen[tmp],border_color,width);
  38.   dest_tmp=tmp+320;
  39.   dest_tmp2=tmp+width-1+320;
  40.   for (a=1;a<height-1;a++)
  41.   {
  42.    memset(&screen[dest_tmp+1],window_color,width-1);
  43.    screen[dest_tmp]=border_color;
  44.    screen[dest_tmp2]=border_color;
  45.  
  46.    dest_tmp+=320;
  47.    dest_tmp2+=320;
  48.   }
  49.   tmp=((y+height-1)<<8)+((y+height-1)<<6)+x;
  50.   memset(&screen[tmp],border_color,width);
  51.  }
  52.  else if (option=FILE_SELECT_WINDOW)
  53.  {
  54.   tmp=(y<<8)+(y<<6)+x;
  55.   memset(&screen[tmp],border_color,width);
  56.   dest_tmp=tmp+320;
  57.   dest_tmp2=tmp+width-1+320;
  58.   for (a=1;a<height-1;a++)
  59.   {
  60.    memset(&screen[dest_tmp+1],window_color,width-1);
  61.    screen[dest_tmp]=border_color;
  62.    screen[dest_tmp2]=border_color;
  63.  
  64.    dest_tmp+=320;
  65.    dest_tmp2+=320;
  66.   }
  67.   tmp=((y+height-1)<<8)+((y+height-1)<<6)+x;
  68.   memset(&screen[tmp],border_color,width);
  69.  
  70.   tmp=((y+10)<<8)+((y+10)<<6)+x;
  71.   memset(&screen[tmp],border_color,width);
  72.   tmp=((y+20)<<8)+((y+20)<<6)+x;
  73.   memset(&screen[tmp],border_color,width);
  74.   tmp=((y+height-11)<<8)+((y+height-11)<<6)+x;
  75.   memset(&screen[tmp],border_color,width);
  76.   tmp=((y+height-21)<<8)+((y+height-21)<<6)+x;
  77.   memset(&screen[tmp],border_color,width);
  78.  
  79.   put_string(x+2+32,y+height-9,"CANCEL",15,NORMAL);
  80.  }
  81. }
  82.  
  83. /****************************************************************************/
  84. /****************************************************************************/
  85. /****************************************************************************/
  86.  
  87. void remove_window(void)
  88. {
  89.  if (window==NULL) return;
  90.  put_image(window_x,window_y,window,window_width,window_height,SET);
  91.  hfree(window);
  92.  window=NULL;
  93. }
  94.  
  95.  
  96.